package com.cloud.form.api.bean;

import java.util.HashMap;
import java.util.Map;

public enum FormFieldAuthorityEnum {
	READ(1), WRITE(2);
	private static final Map<Integer, FormFieldAuthorityEnum> enumMap = new HashMap<Integer, FormFieldAuthorityEnum>();

	static {
		for (FormFieldAuthorityEnum auth : FormFieldAuthorityEnum.values()) {
			enumMap.put(auth.getCode(), auth);
		}
	}

	private int code;

	private FormFieldAuthorityEnum(int code) {
		this.code = code;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public static FormFieldAuthorityEnum getYesNo(Integer code) {
		return enumMap.get(code);
	}
}
